package com.william.jdbcplus.core.dialects.fill.impl;

import com.william.jdbcplus.common.entity.Entity;
import com.william.jdbcplus.core.crud.CrudConfig;
import com.william.jdbcplus.core.dialects.fill.IFill;
import com.william.jdbcplus.core.toolkit.UuidUtil;

import java.util.LinkedList;
import java.util.List;

public class GuidFill implements IFill {
    @Override
    public <M extends Entity> Object getValue(Class<M> entityClass, String fieldName, CrudConfig config) {
        return UuidUtil.get32UUID();
    }

    @Override
    public <M extends Entity> List<?> getValueList(Class<M> entityClass, String fieldName, int count, CrudConfig config) {
        List<String> result = new LinkedList<>();
        for (int i = 1; i <= count; i++) {
            result.add(UuidUtil.get32UUID());
        }
        return result;
    }
}
